package net.xdclass.exception;

import lombok.Data;
import net.xdclass.enums.BizCodeEnum;

/**
 * @Author : zhen.xue
 * @Date: 2021-04-02 11:20
 */
@Data
public class BizException extends RuntimeException{

    private int code;

    private String message;

    public BizException(int code,String message){
        super(message);
        this.code = code;
        this.message = message;
    }

    public BizException(BizCodeEnum bizCodeEnum){
        super(bizCodeEnum.getMessage());
        this.code = bizCodeEnum.getCode();
        this.message = bizCodeEnum.getMessage();
    }
}